import QtQuick 2.0
import org.qtproject.qtquick 1.0

import "../common"
import "../page"
import "../setup"

Rectangle {
    id: id_setupDelegate
    width: parent.width
    height: m_heightItem

    signal click;

    property int m_heightItem;
    property string m_color;

    property int heightNormalItem: 50 * m_ratio

    color: m_color
    SetupFullName {
        id: id_setupFullName
        visible: false
    }

    SetupLabel {
        id: id_setupLable
        visible: false
    }

    SetupShareSocialNetwork {
        id: id_socialNetwork
        visible: false
    }

    Line {}

    MouseArea {
        id: id_mouseArea
        anchors.fill: id_setupDelegate
        onClicked: {
            if (idItem === 4) {
                ApplicationInfo.onDoLogout();
            }
        }
    }

    Component.onCompleted: {
        switch (idItem) {
        case 1:
            id_setupFullName.visible = true;
            m_heightItem = 30 * m_ratio;
            m_color = "#14aaff";
            break;
        case 2:
            m_heightItem = heightNormalItem;
            m_color = "#ffffff";
            id_setupLable.visible = true;
            break;
        case 3:
            m_heightItem = heightNormalItem;
            m_color = "#ffffff";
            id_setupLable.visible = true;
            break;
        case 4:
            m_heightItem = heightNormalItem;
            m_color = "#ffffff";
            id_setupLable.visible = true;
            break;
        case 5:
            m_heightItem = 30 * m_ratio;
            m_color = "#ffffff";
            id_setupLable.visible = true;
            id_setupLable.opacity = 0.5
            break;
        case 6:
            m_heightItem = heightNormalItem;
            m_color = "#ffffff";
            id_setupLable.visible = true;
            break;

        case 7:
            m_heightItem = 100 * m_ratio;
            m_color = "#ffffff";
            id_socialNetwork.visible = true;
            id_mouseArea.enabled = false;
            id_mouseArea.visible = false;
            break;
        default:
            m_heightItem = heightNormalItem;
            m_color = "#ffffff";
            break;
        }
    }
}
